package com.jdz.service.impl;

import com.google.common.collect.Lists;
import com.jdz.common.ServerResponse;
import com.jdz.dao.AwardWinMapper;
import com.jdz.pojo.AwardWin;
import com.jdz.service.IAwardWinService;
import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by sun
 **/
@Service("IAwardWinService")
public class AwardWinServiceImpl implements IAwardWinService {

    private Logger logger = LoggerFactory.getLogger(AwardWinServiceImpl.class);

    @Autowired
    AwardWinMapper awardWinMapper;

    @Override
    public ServerResponse list() {

        List<AwardWin> awardWinList = awardWinMapper.selectList();
        List<String> list = Lists.newArrayList();

        if(CollectionUtils.isEmpty(awardWinList)){
            logger.info("未找到项目奖项");
        }

        for(AwardWin awardWinItem : awardWinList){
            list.add(awardWinItem.getAwardWinname());
        }

        return ServerResponse.createBySuccess(list);
    }

}
